//
//  MainTabView.swift
//  redbox
//
//  Created by ma c on 2025/9/11.
//

import SwiftUI

struct MainTabView: View {
    @EnvironmentObject var boxManager: BoxManager
    @State private var selectedTab = 0
    
    var body: some View {
        TabView(selection: $selectedTab) {
            // 主页 - 福利活动
            HomeView()
                .tabItem {
                    Image(systemName: "house.fill")
                    Text("主页")
                }
                .tag(0)
            
            // 盒子管理
            BoxManagementView()
                .tabItem {
                    Image(systemName: "cube.fill")
                    Text("盒子")
                }
                .tag(1)
            
            // 设置
            SettingsView()
                .tabItem {
                    Image(systemName: "gear")
                    Text("设置")
                }
                .tag(2)
        }
        .accentColor(.blue)
    }
}

#Preview {
    MainTabView()
        .environmentObject(BoxManager.shared)
}